package org.example.controller;

import org.example.base.BaseResp;
import org.example.service.UserInfoService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author huangy
 * @description
 * @since 2022/11/11 17:34
 **/
@RestController
@RequestMapping("userInfo")
public class UserInfoController {

    @Resource
    private UserInfoService userInfoService;

    /**
     * 获取用户信息
     *
     * @author huangy
     * @since 2022/11/13 9:51 上午
     **/
    @PostMapping("getUserInfo")
    public BaseResp<?> getUserInfo() {
        return BaseResp.success(userInfoService.getUserInfo(100000023));
    }

    /**
     * 获取用户集合
     *
     * @author huangy
     * @since 2022/11/13 10:04 上午
     **/
    @PostMapping("getUserInfos")
    public BaseResp<?> getUserInfos() {
        return BaseResp.success(userInfoService.getUserInfos());
    }

    /*
     * @description 更新用户信息
     * @author huangy
     * @since 2022/11/14 10:01
     * @return org.example.base.BaseResp<?>
     **/
    @PostMapping("updateUserInfo")
    public BaseResp<?> updateUserInfo() {
        userInfoService.updateUserInfo(100000056);
        return BaseResp.success();
    }

    /**
     * 批量更新用户信息
     *
     * @author huangy
     * @since 2022/11/13 10:38 上午
     **/
    @PostMapping("updateBatch")
    public BaseResp<?> updateBatch() {
        userInfoService.updateUserInfos();
        return BaseResp.success();
    }

}
